package gui;

import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
/**
 * 
 * @author Idan Mann
 * This is a reusable GUI element, presenting the user with a dialog box and a message
 *
 */
public class Dialog extends JFrame{
	private JButton btnOk;
	private JLabel DialogLabel;
	private JFrame me;
	public Dialog(String dialogText) {
		getContentPane().setLayout(null);
		this.me = this; 
		this.setSize(400, 150);
		btnOk = new JButton("OK");
		btnOk.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			me.setVisible(false);
			me.dispose();
			
			}
		});
		btnOk.setBounds(154, 76, 91, 23);
		getContentPane().add(btnOk);
		
		DialogLabel = new JLabel(dialogText);
		DialogLabel.setBounds(26, 12, 356, 53);
		getContentPane().add(DialogLabel);
	}
}
